package com.zero.storage.service;

import com.zero.storage.mapper.StorageMapper;
import org.apache.seata.spring.annotation.GlobalTransactional;
import org.apache.seata.tm.api.GlobalTransaction;
import org.springframework.stereotype.Service;

/**
 * @author zero
 * @ClassName StorageService
 * @Description
 * @Date 2025/5/15 13:37
 */
@Service
public class StorageService {
    private StorageMapper mapper;
     public StorageService(StorageMapper mapper) {
        this.mapper = mapper;
    }
    @GlobalTransactional
    public void deduct(String commodityCode, int count) {
        mapper.deduct( commodityCode, count);
    }

    @GlobalTransactional
    public void refund(String commodityCode, int count) {
        mapper.refund( commodityCode, count);
    }
}
